Is there a mechanism within the QuickTime playback system to allow me to add
audio to the existing audio during playback? If not, how can I achieve the same
effect?
A In the case of a pure Macintosh application, you can trigger asynchronous
sounds at the same time as the movie sound tracks are playing. The Sound
Manager will happily mix the various sound resources together, as long as there
is adequate system heap space for the sound channels. The Apple MultiMedia
Tuner patches the Sound Manager so that, if there's no space left in the system
heap, it allocates sound channels in the application heap, as long as the
application heap has enough space available. You can also mix the level of the
sound tracks and the other sounds using the QuickTime volume controls. Don't
attempt to play the sounds synchronously, as this interferes with QT movie
tracks playing at the same time, causing sound skipping and many other side
effects. Review the samples on the developer CD and the Inside Sound
manual for additional information.
Unfortunately, this is not a cross-platform solution, as there is no support for doing this in QuickTime for Windows. However, you might be able to implement two different solutions -- the method described above for the Mac, and one of the following methods for Windows:
Microsoft provides a WaveMix driver for Windows that is described in the January 1995 edition of the Microsoft Systems Journal. You can use WaveMix to mix 8-bit sounds together, but you may not be able to use the QTW soundtrack directly with WaveMix, as there's no provision for extracting the sound resource from the QT movie under QTW. If this is the case, you may have to store the sound resources outside the QT movie format, and mix these with WaveMix. The WaveMix driver takes over the one and only sound channel available under Windows, so the only way to mix sounds together in Windows is to forward them to the DLL.
There also appears to be a way to hook into the ACM (Audio Compression Manager) under Video for Windows to get access to the audio buffer (this is designed for audio codecs, but it may be available for other functions).
We're using the MIDIMAPPER drivers in Windows when playing MIDI track
information under QTW 2.0. Using MIDI for game-like
sounds is a very good approach, as this type of sound information is very
small, and you can load it into RAM for fast playback.